﻿@model SlamDunk.CMS.Model.ViewModel.MenusView

@{
    ViewBag.Title = "Add";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section header{
    <script type="text/javascript">
        //提交表单完成后执行方法
        function addFinished(jsonData) {
            if (jsonData.Status == '1') {
                window.top.window.$.messager.alert('OK', jsonData.Message);        //主窗口弹出消息提示
                window.parent.$('#treeMenu').tree('reload');                                 //刷新父窗体的栏目树
            } else {
                window.top.window.$.messager.alert('Error', jsonData.Message);      //主窗口弹出消息提示
            }
        }
    </script>
    <style type="text/css">
        #dvIframe {
            margin-top: 15px;
            width: 400px;
            float: left;
        }

        #tblAdd {
            width: 350px;
            margin: 5px auto 0;
            text-align: right;
        }

            #tblAdd td input[type=text], textarea {
                width: 190px;
            }

        .tdValidate {
            text-align: right;
            color: #ff0000;
        }

        .tdContent {
            text-align: left;
        }
    </style>
}

@using (Ajax.BeginForm("AddConfirm", "Menu", new AjaxOptions { OnSuccess = "addFinished" }, new { id = "frmAdd" }))
{
    <div id="dvIframe">
        <table id="tblAdd">
            <tr>
                <td class="tdTitle">@Html.LabelFor(x => x.PId)：</td>
                <td class="tdContent">
                    @Html.Hidden("PId", ViewBag.PId as string)
                    <input type="text" readonly="readonly" value="@ViewBag.PName" />
                </td>
            </tr>
            <tr>
                <td class="tdValidate" colspan="2">@Html.ValidationMessageFor(x => x.PId)</td>
            </tr>
            <tr>
                <td class="tdTitle">@Html.LabelFor(x => x.MenuName)：</td>
                <td class="tdContent">@Html.TextBoxFor(x => x.MenuName)</td>
            </tr>
            <tr>
                <td class="tdValidate" colspan="2">@Html.ValidationMessageFor(x => x.MenuName)</td>
            </tr>
            <tr>
                <td class="tdTitle">@Html.LabelFor(x => x.Level)：</td>
                <td class="tdContent">@Html.TextBoxFor(x => x.Level)</td>
            </tr>
            <tr>
                <td class="tdValidate" colspan="2">@Html.ValidationMessageFor(x => x.Level)</td>
            </tr>

            <tr>
                <td class="tdTitle">@Html.LabelFor(x => x.Sort)：</td>
                <td class="tdContent">@Html.TextBoxFor(x => x.Sort)</td>
            </tr>
            <tr>
                <td class="tdValidate" colspan="2">@Html.ValidationMessageFor(x => x.Sort)</td>
            </tr>
            <tr>
                <td class="tdTitle">@Html.LabelFor(x => x.IsLink)：</td>
                <td class="tdContent">
                    <select name="IsLink" id="txtIsLink">
                        <option value="true">是</option>
                        <option value="false">否</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">@Html.LabelFor(x => x.Url)：</td>
                <td class="tdContent">@Html.TextBoxFor(x => x.Url)</td>
            </tr>
            <tr>
                <td class="tdValidate" colspan="2">@Html.ValidationMessageFor(x => x.Url)</td>
            </tr>
            <tr>
                <td></td>
                <td class="tdContent">
                    <a href="#" onclick="javascript: $('#frmAdd').submit();" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
                </td>
            </tr>
        </table>
    </div>
}
